<?php
include("./API.php");
include("../config.php");
tongji("xingzuo");
$name=$_GET["msg"];//需要查询的星座
$hh=$_GET["hh"]?:"\n";//换行符号(默认\n)
if($name==""){exit("".$web["ming"]."API星座运势".$hh."━━━━━━━━━".$hh."抱歉，输入为空。".$hh."━━━━━━━━━".$hh."Tips:".$web["ming"]."API技术支持");}
$name=str_replace('座','',$name);
$jk=Array(
"白羊"=>"1",
"金牛"=>"2",
"双子"=>"3",
"巨蟹"=>"4",
"狮子"=>"5",
"处女"=>"6",
"天秤"=>"7",
"天蝎"=>"8",
"射手"=>"9",
"摩羯"=>"10",
"水瓶"=>"11",
"双鱼"=>"12");
$l=$jk[$name];
if($l==""){
exit("".$web["ming"]."API星座运势".$hh."━━━━━━━━━".$hh."不存在此类型，请查证后重试。".$hh."━━━━━━━━━".$hh."Tips:".$web["ming"]."API技术支持");}


$z=file_get_contents("http://cal.meizu.com/android/unauth/horoscope/gethoroscope.do?type=".$l."&date=".date("Y-m-d")."&searchType=0");
$z=myTrim($z);
$p=preg_match_all('/{"contentAll":"(.*?)","contentCareer":"(.*?)","contentFortune":"(.*?)","contentHealth":"(.*?)","contentLove":"(.*?)","contentTravel":"(.*?)","date":(.*?),"direction":"(.*?)","enemies":"(.*?)","friends":"(.*?)","horoscopeType":(.*?),"id":(.*?),"lucklyColor":"(.*?)","lucklyTime":"(.*?)","mark":(.*?),"numbers":(.*?),"pointAll":(.*?),"pointCareer":(.*?),"pointFortune":(.*?),"pointHealth":(.*?),"pointLove":(.*?),"pointTravel":(.*?),"shorts":"(.*?)"}/',$z,$z);
if($p==0){exit("".$web["ming"]."API星座运势".$hh."━━━━━━━━━".$hh."抱歉，获取出错。".$hh."━━━━━━━━━".$hh."Tips:".$web["ming"]."API技术支持");}
$zt=$z[1][0];//整体运势
$sy=$z[2][0];//事业运势
$cf=$z[3][0];//财富运势
$aq=$z[5][0];//爱情运势
$fw=$z[8][0];//贵人方位
$py=$z[10][0];//贵人星座
$ys=$z[13][0];//幸运颜色
$sz=$z[16][0];//幸运数字
$ts=$z[23][0];//提示
echo "".$web["ming"]."API星座运势".$hh."";
echo "━━━━━━━━━".$hh."";
echo "星座：".$name."".$hh."";
echo "贵人方位：".$fw."".$hh."";
echo "贵人星座：".$py."".$hh."";
echo "幸运数字：".$sz."".$hh."";
echo "幸运颜色：".$ys."".$hh."";
echo "爱情运势：".$aq."".$hh."";
echo "财富运势：".$cf."".$hh."";
echo "事业运势：".$sy."".$hh."";
echo "整体运势：".$zt."".$hh."";
echo "提示：".$ts."".$hh."";
echo "━━━━━━━━━".$hh."";
echo "Tips:".$web["ming"]."API技术支持";

function myTrim($str)
{
 $search = array(" ","　","\n","\r","\t");
 $replace = array("","","","","");
 return str_replace($search, $replace, $str);
}

?>